#include "StdAfx.h"
#include "airCraft.h"
#include <osgEarthUtil/ObjectLocator>

airCraft::airCraft(osg::ref_ptr<osgEarth::MapNode> mapnode,osg::ref_ptr<osg::Group> root,osg::Vec3d & d3d,double direction,double ancle)
{
	this->root = root.get();
	this->mapnode =  mapnode.get();
	target.set(d3d);

	pos = new osg::PositionAttitudeTransform();
	pos.get()->setScale(osg::Vec3d(800,800,800));
	//pos.get()->setAttitude(osg::Quat(1,1,1,1));

	x.set(1,1,1,1);

	
	pos.get()->addChild(aircraft.get());
	locator = new osgEarth::Util::ObjectLocator(mapnode.get()->getMap());
	locator.get()->setPosition(target);

	oln = new osgEarth::Util::ObjectLocatorNode(locator.get());
	oln.get()->addChild(pos.get());
	root.get()->addChild(oln.get());
	d_connection  = Glib::signal_timeout().connect(sigc::mem_fun(*this,&airCraft::AirCraftHeart),100);
}

bool  airCraft::AirCraftHeart()
{
	//target.x()--;
	//locator.get()->setPosition(target);
	//pos.get()->setAttitude(x);

	return  true;
}
airCraft::~airCraft(void)
{
}


osg::ref_ptr<osg::Node>	airCraft::getNode()
{

	return  aircraft.get();
}
